package com.pig.consume.invoker;

import java.lang.reflect.Proxy;

/**
 * @author lizhiwei
 */
public class Invoker {
    public static <T> T getInstance(Class<T> cls) {
        ConsumeProxy invocationHandler = new ConsumeProxy();
        Object newProxyInstance = Proxy.newProxyInstance(
                cls.getClassLoader(),
                new Class[]{cls},
                invocationHandler);
        return (T) newProxyInstance;
    }
}
